package com.sun.login;

import android.content.Context;
import android.text.TextUtils;

/*
 * Created by Administrator on 2019/7/30.
 *
 * #                                                   #
 * #                       _oo0oo_                     #
 * #                      o8888888o                    #
 * #                      88" . "88                    #
 * #                      (| -_- |)                    #
 * #                      0\  =  /0                    #
 * #                    ___/`---'\___                  #
 * #                  .' \\|     |# '.                 #
 * #                 / \\|||  :  |||# \                #
 * #                / _||||| -:- |||||- \              #
 * #               |   | \\\  -  #/ |   |              #
 * #               | \_|  ''\---/''  |_/ |             #
 * #               \  .-\__  '-'  ___/-. /             #
 * #             ___'. .'  /--.--\  `. .'___           #
 * #          ."" '<  `.___\_<|>_/___.' >' "".         #
 * #         | | :  `- \`.;`\ _ /`;.`/ - ` : | |       #
 * #         \  \ `_.   \_ __\ /__ _/   .-` /  /       #
 * #     =====`-.____`.___ \_____/___.-`___.-'=====    #
 * #                       `=---='                     #
 * #     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   #
 * #                                                   #
 * #               佛祖保佑         永无BUG              #
 * #                                                   #
 */
public class LoginManager {
    private volatile static LoginManager instance;
    private Context context = LoginApp.getContext();

    public static LoginManager getInstance() {
        if (instance == null)
            synchronized (LoginManager.class) {
                if (instance == null)
                    instance = new LoginManager();
            }
        return instance;
    }

    private LoginManager() {
    }

    public void saveLoginInfo(String tel, String pwd) {
        SPUtils.getInstance().putString("tel", tel);
        SPUtils.getInstance().putString("pwd", pwd);
    }

    public String getTel() {
        return SPUtils.getInstance().getString("tel");
    }

    public String getPwd() {
        return SPUtils.getInstance().getString("pwd");
    }

    public boolean isLogin() {
        String tel = getTel();
        String pwd = getPwd();
        if (TextUtils.isEmpty(tel) || TextUtils.isEmpty(pwd))
            return false;
        return true;
    }

}
